<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSharpToGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sharp_to_goods', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('sharp_id')->index()->comment('活动id');
            $table->integer('goods_id')->index()->comment('商品id');
            $table->integer('sku_id')->index()->comment('sku_id');
            $table->integer('stock')->nullable()->default(0)->comment('秒杀库存');
            $table->integer('sell')->nullable()->default(0)->comment('秒杀售出');
            $table->integer('price')->comment('当前售价');
            $table->integer('line_price')->comment('原价');
            $table->integer('version')->index()->comment('乐观锁标识');
            
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sharp_to_goods');
    }
}
